#ifndef OPTIONUNIT_H
#define OPTIONUNIT_H

#include <QWidget>
#include <QToolButton>
#include "optiongroup.h"
#include <QDate>
#include "sql.h"
#include "optionadd.h"

namespace Ui {
class OptionUnit;
}

class OptionUnit : public QWidget
{
    Q_OBJECT

public:
    explicit OptionUnit(QWidget *parent = nullptr);
    void update(OptionGroup group,bool commit);
    ~OptionUnit();
    /**
     * @brief 处理该模块折叠与非折叠效果
     */
    void changeStatus();
    /**
     * @brief 处理子模块选中效果
     */
    void handleItemStatusChange(short status,long id);
    void deleteSelectedOption();
    void commitSelectedOption();
    QList<long> selected;
    short status;
    int totalOptions;
    SQL* sql = new SQL();
signals:
    void sizeChanged();
    void selectAll();
    void clearSelect();
    void deleteSignal();
    void commitSignal();
    void addSignal();
private:
    Ui::OptionUnit *ui;
    bool hide = true;
//    QWidget* widget;
//    QWidget* title_widget;
//    QToolButton* titleButton;
//    QToolButton* btn_checkBox;

};

#endif // OPTIONUNIT_H
